<?

require_once ("util/Transformer.php");
require_once ("util/Generator.php");
require_once ("dao/MadDAO.php");
require_once ("dao/utilsDAO.php");


class ViewMSup4_ScanearChancela {

	public function show($_REQUEST)
	{

		$transformer = new Transformer();
		$generator = new Generator();
		$transformer->setDirFisicoTemplates("template/");
		$transformer->setArquivoTemplate("esqueletoBase.htm");
		$valoresTroca = array ();
		$valoresTroca["titulo"] = $this->getTitulo();
		$valoresTroca["combo"] = $generator->getCombo();
		//$valoresTroca["header"] = $generator->getHeader();
		//$valoresTroca["menu"] = $generator->getMenu();
		//$valoresTroca["atalhos"] = $generator->getAtalhos("marcacao");
		$valoresTroca["footer"] = $generator->getFooter();
		$valoresTroca["erro"] = $generator->getErro();
		$valoresTroca["body"] = $this->getBody($_REQUEST);
		$transformer->setValoresTroca($valoresTroca);
		$saida = $transformer->processaHTML();
		echo $saida;
	}

	private function getTitulo()
	{
		$titulo = "SIMweb :: Scanear Chancela";
		return $titulo;
	}



	private function getBody($_REQUEST){
		$valoresTroca = array();

		$httpDirName = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/";
		
		$util = new utilsDAO();
		
        //ver($_REQUEST,0);
		$valoresTroca['idChancela'] = $_REQUEST['idChancela'];
		$valoresTroca['nome'] = $_REQUEST['nome'];
		$valoresTroca['data'] = $_REQUEST['data'];
		$valoresTroca['acao'] = $_REQUEST['acao'];
		$valoresTroca['controler'] = $_REQUEST['controler'];
		
		
		$valoresTroca["H1"] = "nodisplay";
		$valoresTroca["H2"] = "";	
		$valoresTroca["visivel"] = "inMM2";

		//ver($_REQUEST);
		
		if ($_REQUEST['controler'] == 'alterar')
		{
		
			$valoresTroca["H1"] = "";
		    $valoresTroca["H2"] = "nodisplay";	
		    $valoresTroca["visivel"] = "inMM";
		    $valoresTroca["read"] = 'readonly = "readonly"'; 
			
		}
		
		$valoresTroca['actionPHP'] = $httpDirName.'index.php?action=ActionMSup4GerenciaChancela';
		//ver($valoresTroca,1);
		$valoresTroca['dllPath']= $httpDirName."java/";
		
		$transformer = new Transformer();
		$transformer->setDirFisicoTemplates("template/");
		$transformer->setArquivoTemplate("MSup/MSup4_ScanearChancela.htm");
		$transformer->setValoresTroca($valoresTroca);
		$saida = $transformer->processaHTML();
		return $saida;

	}
}

?>